home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1993 April: Penguin on DISC / ADC Developer CD (1993-04) (''Penguin On DISC'')_iso / Dev.CD Apr 93.iso / Utilities / MPW Interfaces 7.1 Beta / PInterfaces / Picker.p < prev    next >
Encoding:
Text File  |  1992-08-28  |  2.4 KB  |  92 lines  |  [TEXT/MPS ]

  1.  
  2. {
  3. Created: Monday, September 16, 1991 at 12:02 AM
  4.  Picker.p
  5.  Pascal Interface to the Macintosh Libraries
  6.  
  7.   Copyright Apple Computer, Inc. 1987-1991
  8.   All rights reserved
  9. }
  10.  
  11.  
  12. {$IFC UNDEFINED UsingIncludes}
  13. {$SETC UsingIncludes := 0}
  14. {$ENDC}
  15.  
  16. {$IFC NOT UsingIncludes}
  17.  UNIT Picker;
  18.  INTERFACE
  19. {$ENDC}
  20.  
  21. {$IFC UNDEFINED UsingPicker}
  22. {$SETC UsingPicker := 1}
  23.  
  24. {$I+}
  25. {$SETC PickerIncludes := UsingIncludes}
  26. {$SETC UsingIncludes := 1}
  27. {$IFC UNDEFINED UsingQuickdraw}
  28. {$I $$Shell(PInterfaces)Quickdraw.p}
  29. {$ENDC}
  30. {$SETC UsingIncludes := PickerIncludes}
  31.  
  32. CONST
  33. MaxSmallFract = $0000FFFF;    {Maximum small fract value, as long}
  34.  
  35. TYPE
  36. { A SmallFract value is just the fractional part of a Fixed number,
  37. which is the low order word.  SmallFracts are used to save room,
  38. and to be compatible with Quickdraw's RGBColor.  They can be
  39. assigned directly to and from INTEGERs. }
  40.  
  41. SmallFract = INTEGER;        { Unsigned fraction between 0 and 1 }
  42.  
  43. { For developmental simplicity in switching between the HLS and HSV
  44. models, HLS is reordered into HSL. Thus both models start with
  45. hue and saturation values; value/lightness/brightness is last. }
  46.  
  47. HSVColor = RECORD
  48.  hue: SmallFract;            {Fraction of circle, red at 0}
  49.  saturation: SmallFract;    {0-1, 0 for gray, 1 for pure color}
  50.  value: SmallFract;            {0-1, 0 for black, 1 for max intensity}
  51.  END;
  52.  
  53. HSLColor = RECORD
  54.  hue: SmallFract;            {Fraction of circle, red at 0}
  55.  saturation: SmallFract;    {0-1, 0 for gray, 1 for pure color}
  56.  lightness: SmallFract;        {0-1, 0 for black, 1 for white}
  57.  END;
  58.  
  59. CMYColor = RECORD
  60.  cyan: SmallFract;
  61.  magenta: SmallFract;
  62.  yellow: SmallFract;
  63.  END;
  64.  
  65.  
  66. FUNCTION Fix2SmallFract(f: Fixed): SmallFract;
  67.  INLINE $3F3C,$0001,$A82E;
  68. FUNCTION SmallFract2Fix(s: SmallFract): Fixed;
  69.  INLINE $3F3C,$0002,$A82E;
  70. PROCEDURE CMY2RGB(cColor: CMYColor;VAR rColor: RGBColor);
  71.  INLINE $3F3C,$0003,$A82E;
  72. PROCEDURE RGB2CMY(rColor: RGBColor;VAR cColor: CMYColor);
  73.  INLINE $3F3C,$0004,$A82E;
  74. PROCEDURE HSL2RGB(hColor: HSLColor;VAR rColor: RGBColor);
  75.  INLINE $3F3C,$0005,$A82E;
  76. PROCEDURE RGB2HSL(rColor: RGBColor;VAR hColor: HSLColor);
  77.  INLINE $3F3C,$0006,$A82E;
  78. PROCEDURE HSV2RGB(hColor: HSVColor;VAR rColor: RGBColor);
  79.  INLINE $3F3C,$0007,$A82E;
  80. PROCEDURE RGB2HSV(rColor: RGBColor;VAR hColor: HSVColor);
  81.  INLINE $3F3C,$0008,$A82E;
  82. FUNCTION GetColor(where: Point;prompt: Str255;inColor: RGBColor;VAR outColor: RGBColor): BOOLEAN;
  83.  INLINE $3F3C,$0009,$A82E;
  84.  
  85.  
  86. {$ENDC} { UsingPicker }
  87.  
  88. {$IFC NOT UsingIncludes}
  89.  END.
  90. {$ENDC}
  91.  
  92.